package com.weipai.springboot.module.controller;

import com.weipai.springboot.model.ShopCart;
import com.weipai.springboot.model.api.Response;
import com.weipai.springboot.module.service.ShopCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 曹朋飞
 * @Date: 2018/08/27 15:48
 * 
 * 购物车控制类
 */
@RestController
public class ShopCartController {

    @Autowired
    ShopCartService shopCartService;
    
    /**
     * 加入购物车
     * @param shopCart
     * @return
     */
    @PostMapping("/shopCart/addToShopCart")
    public Response addToShopCart(ShopCart shopCart){
        return shopCartService.addToShopCart(shopCart);
    }

    /**
     * 购物车商品 --列表
     * @return
     */
    @GetMapping("/shopCart/shopCartList")
    public Response shopCartList(){
        return shopCartService.shopCartList();
    }

    /**
     * 删除购物车商品

     * @return
     */
    @RequestMapping("/shopCart/deleteShopCartById")
    public Response deleteShopCartById(Integer[] ids){
        return shopCartService.deleteShopCartById(ids);
    }
    
}
